import request from '@/utils/request'
// 获取文章分类接口
export const getArtCateListAPI = () => {
  return request({
    url: '/my/cate/list',
    method: 'GET'
  })
}
// 添加文章分类的接口
export const addArtCateListAPI = ({ cate_name, cate_alias }) => {
  return request({
    url: '/my/cate/add',
    method: 'POST',
    data: {
      cate_name,
      cate_alias
    }
  })
}
// 更新文章分类的接口
export const updateArtCateAPI = ({ id, cate_name, cate_alias }) => {
  return request({
    url: '/my/cate/info',
    method: 'PUT',
    data: {
      id,
      cate_name,
      cate_alias
    }
  })
}
/**
 * 删除-文章分类
 * @param {*} id 要删除的-文章分类id
 * @returns Promise对象
 */
// 删除文章分类的接口
export const deleteArtCateAPI = (id) => {
  return request({
    url: '/my/cate/del',
    method: 'DELETE',
    params: {
      id
    }
  })
}
// 上传文章的接口
export const uploadArticleApi = (fd) => {
  return request({
    url: '/my/article/add',
    method: 'POST',
    data: fd
  })
}
/**
 * 获取文章列表
 * @param {*} param0 { pagenum: 当前页码数, pagesize: 当前页条数, cate_id: 文章分类id, state: 文章状态 }
 * @returns Promise对象
 */
export const getArticleListAPI = ({ pagenum, pagesize, cate_id, state }) => {
  return request({
    url: '/my/article/list',
    method: 'get',
    params: {
      pagenum,
      pagesize,
      cate_id,
      state
    }
  })
}
/**
 * 获取文章详情接口
 * @param {*} param0 { id:文章id}
 * @returns Promise对象
 */
export const getArtDetailAPI = (id) => {
  return request({
    url: '/my/article/info',
    method: 'GET',
    params: {
      id
    }
  })
}
/**
 * 删除文章详情接口
 * @param {*} param0 { id:文章id}
 * @returns Promise对象
 */
export const deleteArtDetailAPI = (id) => {
  return request({
    url: '/my/article/info',
    method: 'DELETE',
    params: {
      id
    }
  })
}
